package com.bfmet.common.base;

import java.io.IOException;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public abstract class ServletBase extends UtilBase implements Servlet {

	@Override
	public void destroy() {

	}

	@Override
	public ServletConfig getServletConfig() {
		return null;
	}

	@Override
	public String getServletInfo() {
		return null;
	}

	@Override
	public void init(ServletConfig arg0) throws ServletException {

	}

	@Override
	public void service(ServletRequest request, ServletResponse response)
			throws ServletException, IOException {
		this.lock.lock();
		try {
			this.doGet(request, response);
		} catch (Exception ex) {
			this.logException(ex);
		} finally {
			this.lock.unlock();
		}

	}

	protected abstract void doGet(ServletRequest request,
			ServletResponse response) throws ServletException, IOException;

}
